@extends('backstage.layout.master')
@section('title', 'Android版本管理')
@section('content')
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try {
                ace.settings.check('breadcrumbs', 'fixed')
            } catch (e) {
            }
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="backstage/home">主页</a>
            </li>

            <li class="active">
                <a href="backstage/android/android-version-list">Android版本管理</a>
            </li>
        </ul><!-- .breadcrumb -->
    </div>

    <div class="page-content">
        <div class="page-header">
            <h1>
                Android版本列表
                <span class="pull-right">
                    <button class="btn btn-primary" onclick="javascript:window.location.href='/backstage/config/new-android-version';">版本录入</button>
                </span>
            </h1>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <div class="table-responsive">
                    <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th>版本名称</th>
                            <th>包大小</th>
                            <th>更新描述</th>
                            <th>下载地址</th>
                            <th>是否强制升级</th>
                            <th>更新时间</th>
                            <th>版本号</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @if(isset($lists))
                        @foreach($lists as $list)
                            <tr class="" data-tr-id="{{$list->id}}">
                                <td>
                                    {{isset($list->version_name)? $list->version_name : ''}}
                                </td>
                                <td>{{isset($list->pakage_size) ? $list->pakage_size : ''}}</td>
                                <td>
                                    {{isset($list->update_describe) ? $list->update_describe : ''}}
                                </td>
                                <td>{{isset($list->download_url) ? $list->download_url : ''}}</td>
                                <td>
                                    @if(isset($list->is_must_update) && $list->is_must_update == 1)
                                    是
                                    @else
                                    否
                                    @endif
                                </td>
                                <td>{{isset($list->update_time) ? $list->update_time : ''}}</td>
                                <td>{{isset($list->version_code) ? $list->version_code : ''}}</td>
                                <td>
                                    <a style="cursor: pointer;" onclick="delete_version('{{$list->id}}')">删除</a>
                                </td>
                            </tr>
                        @endforeach
                        @endif
                        </tbody>
                    </table>
                </div>
                <!-- PAGE CONTENT ENDS -->
                <div class="row">
                    <div class="col-sm-6">
                        <div class="dataTables_info" id="sample-table-2_info"></div>
                    </div>
                    <div class="col-sm-6">
                        <div class="dataTables_paginate paging_bootstrap">
                            <?php echo $lists->render(); ?>
                        </div>
                    </div>
                </div>
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.page-content -->
@stop
@section('script')
<script type="text/javascript">
    function delete_version(th){
        swal('处理中','请稍后','warning');

        $.ajax({
            url:"/backstage/config/delete-android-version",
            type:"post",
            data:{"id" : th},
            datatype:"json",
            success:function(re){
                if(re.state=="M00000"){
                    swal(re.message,'','success');
                    location.reload();
                    return;
                }
                swal(re.message,'','warning');
                return;
            },
            error:function(){
                swal('系统繁忙','请稍后重试','warning');
                return;
            }
        });
    }
</script>
@stop
